﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Simple.Repository.Models
{
    public class LeaveMessageReply : BusinessFullEntityBase<Guid>
    {
        /// <summary>
        /// 回复内容
        /// </summary>
        public string? ReplyContent { get; set; }

        /// <summary>
        /// 回复人姓名
        /// </summary>
        public string? ReplyUserName { get; set; }

        /// <summary>
        /// 回复人时间
        /// </summary>
        public DateTime? ReplyTime { get; set; }

        /// <summary>
        /// 留言Id
        /// </summary>
        public Guid? LeaveMessageId { get; set; } = null;

        /// <summary>
        /// 父级回复
        /// </summary>
        public string? ParentId { get; set; }

        /// <summary>
        /// 是否发布
        /// </summary>
        public bool IsPublish { get; set; } = true;

        // <summary>
        /// 留言
        /// </summary>
        public ClassDynamicLeaveMessage LeaveMessage = new ClassDynamicLeaveMessage();

        public override void ConfigureEntity(ModelBuilder builder)
        {
            builder.Entity<LeaveMessageReply>(entity =>
            {
                entity.ToTable("Class_LeaveMessageReply");
                entity.HasOne(c => c.LeaveMessage).WithMany(c => c.Replys).HasForeignKey(c => c.LeaveMessageId);
            });
        }
    }
}
